Optimal. Leaf size=156 \[ \frac {8 i a^3 (e \sec (c+d x))^{6-2 n} (a+i a \tan (c+d x))^{-3+n}}{d (5-n) \left (12-7 n+n^2\right )}+\frac {4 i a^2 (e \sec (c+d x))^{6-2 n} (a+i a \tan (c+d x))^{-2+n}}{d \left (20-9 n+n^2\right )}+\frac {i a (e \sec (c+d x))^{6-2 n} (a+i a \tan (c+d x))^{-1+n}}{d (5-n)} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.17, antiderivative size = 156, normalized size of antiderivative = 1.00, number of steps
used = 3, number of rules used = 2, integrand size = 30, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.067, Rules used = {3575, 3574}
\begin {gather*} \frac {8 i a^3 (a+i a \tan (c+d x))^{n-3} (e \sec (c+d x))^{6-2 n}}{d (5-n) \left (n^2-7 n+12\right )}+\frac {4 i a^2 (a+i a \tan (c+d x))^{n-2} (e \sec (c+d x))^{6-2 n}}{d \left (n^2-9 n+20\right )}+\frac {i a (a+i a \tan (c+d x))^{n-1} (e \sec (c+d x))^{6-2 n}}{d (5-n)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 3574
Rule 3575
Rubi steps
\begin {align*} \int (e \sec (c+d x))^{6-2 n} (a+i a \tan (c+d x))^n \, dx &=\frac {i a (e \sec (c+d x))^{6-2 n} (a+i a \tan (c+d x))^{-1+n}}{d (5-n)}+\frac {(4 a) \int (e \sec (c+d x))^{6-2 n} (a+i a \tan (c+d x))^{-1+n} \, dx}{5-n}\\ &=\frac {4 i a^2 (e \sec (c+d x))^{6-2 n} (a+i a \tan (c+d x))^{-2+n}}{d \left (20-9 n+n^2\right )}+\frac {i a (e \sec (c+d x))^{6-2 n} (a+i a \tan (c+d x))^{-1+n}}{d (5-n)}+\frac {\left (8 a^2\right ) \int (e \sec (c+d x))^{6-2 n} (a+i a \tan (c+d x))^{-2+n} \, dx}{20-9 n+n^2}\\ &=\frac {8 i a^3 (e \sec (c+d x))^{6-2 n} (a+i a \tan (c+d x))^{-3+n}}{d (3-n) \left (20-9 n+n^2\right )}+\frac {4 i a^2 (e \sec (c+d x))^{6-2 n} (a+i a \tan (c+d x))^{-2+n}}{d \left (20-9 n+n^2\right )}+\frac {i a (e \sec (c+d x))^{6-2 n} (a+i a \tan (c+d x))^{-1+n}}{d (5-n)}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 2.35, size = 122, normalized size = 0.78 \begin {gather*} -\frac {e^6 \sec ^5(c+d x) (e \sec (c+d x))^{-2 n} \left (-2 (-5+n)+\left (22-9 n+n^2\right ) \cos (2 (c+d x))+i \left (18-9 n+n^2\right ) \sin (2 (c+d x))\right ) (i \cos (3 (c+d x))+\sin (3 (c+d x))) (a+i a \tan (c+d x))^n}{d (-5+n) (-4+n) (-3+n)} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [F]
time = 0.84, size = 0, normalized size = 0.00 \[\int \left (e \sec \left (d x +c \right )\right )^{6-2 n} \left (a +i a \tan \left (d x +c \right )\right )^{n}\, dx\]
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [B] Both result and optimal contain complex but leaf count of result is larger than
twice the leaf count of optimal. 865 vs. \(2 (143) = 286\).
time = 1.74, size = 865, normalized size = 5.54 \begin {gather*} -\frac {32 \, {\left ({\left (a^{n} n^{2} e^{6} - 9 \, a^{n} n e^{6} + 20 \, a^{n} e^{6}\right )} {\left (\cos \left (2 \, d x + 2 \, c\right )^{2} + \sin \left (2 \, d x + 2 \, c\right )^{2} + 2 \, \cos \left (2 \, d x + 2 \, c\right ) + 1\right )}^{\frac {1}{2} \, n} \cos \left (4 \, d x + n \arctan \left (\sin \left (2 \, d x + 2 \, c\right ), \cos \left (2 \, d x + 2 \, c\right ) + 1\right ) + 4 \, c\right ) - 2 \, {\left (a^{n} n e^{6} - 5 \, a^{n} e^{6}\right )} {\left (\cos \left (2 \, d x + 2 \, c\right )^{2} + \sin \left (2 \, d x + 2 \, c\right )^{2} + 2 \, \cos \left (2 \, d x + 2 \, c\right ) + 1\right )}^{\frac {1}{2} \, n} \cos \left (2 \, d x + n \arctan \left (\sin \left (2 \, d x + 2 \, c\right ), \cos \left (2 \, d x + 2 \, c\right ) + 1\right ) + 2 \, c\right ) + 2 \, a^{n} \cos \left (n \arctan \left (\sin \left (2 \, d x + 2 \, c\right ), \cos \left (2 \, d x + 2 \, c\right ) + 1\right )\right ) e^{\left (\frac {1}{2} \, n \log \left (\cos \left (2 \, d x + 2 \, c\right )^{2} + \sin \left (2 \, d x + 2 \, c\right )^{2} + 2 \, \cos \left (2 \, d x + 2 \, c\right ) + 1\right ) + 6\right )} - {\left (-i \, a^{n} n^{2} e^{6} + 9 i \, a^{n} n e^{6} - 20 i \, a^{n} e^{6}\right )} {\left (\cos \left (2 \, d x + 2 \, c\right )^{2} + \sin \left (2 \, d x + 2 \, c\right )^{2} + 2 \, \cos \left (2 \, d x + 2 \, c\right ) + 1\right )}^{\frac {1}{2} \, n} \sin \left (4 \, d x + n \arctan \left (\sin \left (2 \, d x + 2 \, c\right ), \cos \left (2 \, d x + 2 \, c\right ) + 1\right ) + 4 \, c\right ) - 2 \, {\left (i \, a^{n} n e^{6} - 5 i \, a^{n} e^{6}\right )} {\left (\cos \left (2 \, d x + 2 \, c\right )^{2} + \sin \left (2 \, d x + 2 \, c\right )^{2} + 2 \, \cos \left (2 \, d x + 2 \, c\right ) + 1\right )}^{\frac {1}{2} \, n} \sin \left (2 \, d x + n \arctan \left (\sin \left (2 \, d x + 2 \, c\right ), \cos \left (2 \, d x + 2 \, c\right ) + 1\right ) + 2 \, c\right ) + 2 i \, a^{n} e^{\left (\frac {1}{2} \, n \log \left (\cos \left (2 \, d x + 2 \, c\right )^{2} + \sin \left (2 \, d x + 2 \, c\right )^{2} + 2 \, \cos \left (2 \, d x + 2 \, c\right ) + 1\right ) + 6\right )} \sin \left (n \arctan \left (\sin \left (2 \, d x + 2 \, c\right ), \cos \left (2 \, d x + 2 \, c\right ) + 1\right )\right )\right )}}{{\left ({\left (-i \, n^{3} + 12 i \, n^{2} - 47 i \, n + 60 i\right )} 2^{n} \cos \left (10 \, d x + 10 \, c\right ) e^{\left (2 \, n\right )} - 5 \, {\left (i \, n^{3} - 12 i \, n^{2} + 47 i \, n - 60 i\right )} 2^{n} \cos \left (8 \, d x + 8 \, c\right ) e^{\left (2 \, n\right )} - 10 \, {\left (i \, n^{3} - 12 i \, n^{2} + 47 i \, n - 60 i\right )} 2^{n} \cos \left (6 \, d x + 6 \, c\right ) e^{\left (2 \, n\right )} - 10 \, {\left (i \, n^{3} - 12 i \, n^{2} + 47 i \, n - 60 i\right )} 2^{n} \cos \left (4 \, d x + 4 \, c\right ) e^{\left (2 \, n\right )} - 5 \, {\left (i \, n^{3} - 12 i \, n^{2} + 47 i \, n - 60 i\right )} 2^{n} \cos \left (2 \, d x + 2 \, c\right ) e^{\left (2 \, n\right )} + {\left (n^{3} - 12 \, n^{2} + 47 \, n - 60\right )} 2^{n} e^{\left (2 \, n\right )} \sin \left (10 \, d x + 10 \, c\right ) + 5 \, {\left (n^{3} - 12 \, n^{2} + 47 \, n - 60\right )} 2^{n} e^{\left (2 \, n\right )} \sin \left (8 \, d x + 8 \, c\right ) + 10 \, {\left (n^{3} - 12 \, n^{2} + 47 \, n - 60\right )} 2^{n} e^{\left (2 \, n\right )} \sin \left (6 \, d x + 6 \, c\right ) + 10 \, {\left (n^{3} - 12 \, n^{2} + 47 \, n - 60\right )} 2^{n} e^{\left (2 \, n\right )} \sin \left (4 \, d x + 4 \, c\right ) + 5 \, {\left (n^{3} - 12 \, n^{2} + 47 \, n - 60\right )} 2^{n} e^{\left (2 \, n\right )} \sin \left (2 \, d x + 2 \, c\right ) + {\left (-i \, n^{3} + 12 i \, n^{2} - 47 i \, n + 60 i\right )} 2^{n} e^{\left (2 \, n\right )}\right )} d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 0.43, size = 165, normalized size = 1.06 \begin {gather*} \frac {{\left ({\left (-i \, n^{2} + 9 i \, n - 20 i\right )} e^{\left (6 i \, d x + 6 i \, c\right )} + {\left (-i \, n^{2} + 11 i \, n - 30 i\right )} e^{\left (4 i \, d x + 4 i \, c\right )} - 2 \, {\left (-i \, n + 6 i\right )} e^{\left (2 i \, d x + 2 i \, c\right )} - 2 i\right )} \left (\frac {2 \, e^{\left (i \, d x + i \, c + 1\right )}}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}\right )^{-2 \, n + 6} e^{\left (i \, d n x + i \, c n - 6 i \, d x + n \log \left (a e^{\left (-1\right )}\right ) + n \log \left (\frac {2 \, e^{\left (i \, d x + i \, c + 1\right )}}{e^{\left (2 i \, d x + 2 i \, c\right )} + 1}\right ) - 6 i \, c\right )}}{2 \, {\left (d n^{3} - 12 \, d n^{2} + 47 \, d n - 60 \, d\right )}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {could not integrate} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 10.33, size = 318, normalized size = 2.04 \begin {gather*} \left (\cos \left (6\,c+6\,d\,x\right )-\sin \left (6\,c+6\,d\,x\right )\,1{}\mathrm {i}\right )\,{\left (\frac {e}{\cos \left (c+d\,x\right )}\right )}^{6-2\,n}\,\left (\frac {{\left (a+\frac {a\,\sin \left (c+d\,x\right )\,1{}\mathrm {i}}{\cos \left (c+d\,x\right )}\right )}^n}{d\,\left (n^3\,1{}\mathrm {i}-n^2\,12{}\mathrm {i}+n\,47{}\mathrm {i}-60{}\mathrm {i}\right )}-\frac {\left (2\,n-12\right )\,\left (\cos \left (2\,c+2\,d\,x\right )+\sin \left (2\,c+2\,d\,x\right )\,1{}\mathrm {i}\right )\,{\left (a+\frac {a\,\sin \left (c+d\,x\right )\,1{}\mathrm {i}}{\cos \left (c+d\,x\right )}\right )}^n}{2\,d\,\left (n^3\,1{}\mathrm {i}-n^2\,12{}\mathrm {i}+n\,47{}\mathrm {i}-60{}\mathrm {i}\right )}+\frac {\left (\cos \left (6\,c+6\,d\,x\right )+\sin \left (6\,c+6\,d\,x\right )\,1{}\mathrm {i}\right )\,{\left (a+\frac {a\,\sin \left (c+d\,x\right )\,1{}\mathrm {i}}{\cos \left (c+d\,x\right )}\right )}^n\,\left (n^2-9\,n+20\right )}{2\,d\,\left (n^3\,1{}\mathrm {i}-n^2\,12{}\mathrm {i}+n\,47{}\mathrm {i}-60{}\mathrm {i}\right )}+\frac {\left (\cos \left (4\,c+4\,d\,x\right )+\sin \left (4\,c+4\,d\,x\right )\,1{}\mathrm {i}\right )\,{\left (a+\frac {a\,\sin \left (c+d\,x\right )\,1{}\mathrm {i}}{\cos \left (c+d\,x\right )}\right )}^n\,\left (n^2-11\,n+30\right )}{2\,d\,\left (n^3\,1{}\mathrm {i}-n^2\,12{}\mathrm {i}+n\,47{}\mathrm {i}-60{}\mathrm {i}\right )}\right ) \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________